package top.longmarch.flow.api;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.longmarch.flow.service.impl.FlowExecutorServer;
import top.longmarch.flow.utils.Result;

import javax.annotation.Resource;
import java.util.Map;

@Api(tags = "组件流程API")
@RestController
@RequestMapping("/flow")
public class FlowExecutorApi {

    @Resource
    private FlowExecutorServer flowExecutorServer;

    @ApiOperation(value = "组件化流程通用执行接口")
    @PostMapping("/flowExecutor")
    public Result<Object> flowExecutor(@RequestBody Map<String, Object> params) {
        return Result.ok(flowExecutorServer.run(params));
    }

}
